package com.hpf.lease.common.config;

import com.hpf.lease.common.result.ResultCodeEnum;
import lombok.Data;

@Data
public class CommonException extends RuntimeException{
    private Integer code;
    private String message;
    private Throwable throwable;
    public CommonException(Integer code,String message){
        this.code = code;
        this.message = message;
    }
    public CommonException(Integer code,String message,Throwable throwable){
        this.code = code;
        this.message = message;
        this.throwable = throwable;
    }
    public CommonException(ResultCodeEnum resultCodeEnum){
        this(resultCodeEnum.getCode(), resultCodeEnum.getMessage());
    }
    public CommonException(ResultCodeEnum resultCodeEnum,Throwable throwable){
        this(resultCodeEnum.getCode(), resultCodeEnum.getMessage(),throwable);
    }
}
